<?php /* Smarty version 2.6.27, created on 2019-11-05 01:58:42
         compiled from user/uers_list.tpl */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('modifier', 't', 'user/uers_list.tpl', 4, false),)), $this); ?>
<table id="user_list" class="itable">
    <thead>
        <tr>
            <th><?php echo ((is_array($_tmp='用户名')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
</th>
            <th><?php echo ((is_array($_tmp='姓名')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
</th>
            <th><?php echo ((is_array($_tmp='部门')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
</th>
            <th><?php echo ((is_array($_tmp='用户组')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
</th>
            <th><?php echo ((is_array($_tmp='创建时间')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
</th>
            <th><?php echo ((is_array($_tmp='最后登录时间')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
</th>
            <th><?php echo ((is_array($_tmp='最后登录ip')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
</th>
            <th><?php echo ((is_array($_tmp='过期时间')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
</th>
            <th><?php echo ((is_array($_tmp='email')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
</th>
            <th><?php echo ((is_array($_tmp='电话')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
</th>
            <th><?php echo ((is_array($_tmp='账号状态')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
</th>
            <th><?php echo ((is_array($_tmp='操作')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
</th>
        </tr>
    </thead>
    <tbody>
        <?php $_from = $this->_tpl_vars['list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['item']):
?>
            <tr>
                <td><?php echo $this->_tpl_vars['item']['username']; ?>
</td>
                <td><?php echo $this->_tpl_vars['item']['name']; ?>
</td>
                <td class="edit_department" id="<?php echo $this->_tpl_vars['item']['uid']; ?>
" field="department"><?php echo $this->_tpl_vars['item']['department']; ?>
</td>
                <td class="edit_group" id="<?php echo $this->_tpl_vars['item']['uid']; ?>
" field="groupid"><?php echo $this->_tpl_vars['item']['groupname']; ?>
</td>
                <td><?php echo $this->_tpl_vars['item']['created_format']; ?>
</td>
                <td><?php echo $this->_tpl_vars['item']['last_login_time_format']; ?>
</td>
                <td><?php echo $this->_tpl_vars['item']['last_login_ip']; ?>
</td>
                <td><a uid="<?php echo $this->_tpl_vars['item']['uid']; ?>
" class="delay_account" href="javascript:void(0)" title="点击延长账号使用期限"><?php echo $this->_tpl_vars['item']['expiration_format']; ?>
</td>
                <td class="edit" id="<?php echo $this->_tpl_vars['item']['uid']; ?>
" field="email"><?php echo $this->_tpl_vars['item']['email']; ?>
</td>
                <td class="edit" id="<?php echo $this->_tpl_vars['item']['uid']; ?>
" field="tel"><?php echo $this->_tpl_vars['item']['tel']; ?>
</td>
                <td><?php echo $this->_tpl_vars['item']['status_msg']; ?>
</td>
                <td>
                    <?php if ($this->_tpl_vars['item']['status'] <> @USER_STATUS_NORMAL): ?>
                        <a href="javascript:void(0)" onclick="forbid_user(<?php echo $this->_tpl_vars['item']['uid']; ?>
, 1)" title="封禁帐号"><font color="red"><?php echo ((is_array($_tmp='解')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
</font></a>
                    <?php else: ?>
                        <a href="javascript:void(0)" onclick="forbid_user(<?php echo $this->_tpl_vars['item']['uid']; ?>
, 2)" title="解封帐号"><?php echo ((is_array($_tmp='封')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
</a>
                    <?php endif; ?>
                    |
                    <a href="javascript:void(0)" onclick="del_user(<?php echo $this->_tpl_vars['item']['uid']; ?>
)" title="删除帐号"><?php echo ((is_array($_tmp='删')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
</a> |
                    <a href="javascript:void(0)" onclick="reset_password(<?php echo $this->_tpl_vars['item']['uid']; ?>
)" title="重置密码"><?php echo ((is_array($_tmp='密')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
</a> |
                    <a href="javascript:void(0)" onclick="clear_login_err('<?php echo $this->_tpl_vars['item']['username']; ?>
')" title="清空错误登录次数"><?php echo ((is_array($_tmp='清')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
</a>
                </td>
            </tr>
        <?php endforeach; endif; unset($_from); ?>
    </tbody>
</table>


<script type="text/javascript">
var tTable = $("#user_list").dataTable({
    "oLanguage": {
        "sUrl": "style/js/dt_cn.txt"
    },
    "aaSorting": [
        [ 3, "asc" ]
    ],
    "iDisplayLength":100,
    "sPaginationType": "full_numbers",
    "sDom": '<"top"lfp>rt<"bottom"ip><"clear">',

    "bFilter": true
});

//修改部门
$('.edit_department').editable("admin.php?ctrl=user&act=submit&type=alter_department", {
    indicator : "<img src='style/images/indicator.gif'>",
    height    : "15px",
    submit    : "<?php echo ((is_array($_tmp='修改')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
",
    cancel    : "<?php echo ((is_array($_tmp='取消')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
",
    tooltip   : "<?php echo ((is_array($_tmp='点击修改')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
...",
    style  : "inherit"
});

//修改用户组
$('.edit_group').editable("admin.php?ctrl=user&act=submit&type=alter_userGrounp", {
    indicator : "<img src='style/images/indicator.gif'>",
    type   : 'select',
    data : <?php echo $this->_tpl_vars['groupNames']; ?>
,
    height    : "15px",
    submit    : "<?php echo ((is_array($_tmp='修改')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
",
    cancel    : "<?php echo ((is_array($_tmp='取消')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
",
    tooltip   : "<?php echo ((is_array($_tmp='点击修改')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
...",
    style  : "inherit"
});


//延长有限期
$('.delay_account').click(function(){
    var uid = $(this).attr('uid');
    var expiration_format = $(this).html();
    var th_is = $(this);
    $.ajax({
        type: "POST",
        url: "admin.php?ctrl=user&act=submit&type=delay_account",
        data: "uid="+uid+"&expiration_format="+expiration_format,
        timeout: 20000,
        error: function(){alert('error')},
        success: function(result){
            th_is.html(result);
        }
    });
});

//封禁&解封账号
function forbid_user(uid, status){
    if(confirm('<?php echo ((is_array($_tmp='确定操作该账号?')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
')){
        $.ajax({
          type: "POST",
          url: "admin.php?ctrl=user&act=submit&type=ben_user",
          data: "value="+status+"&id="+uid,
          timeout: 20000,
          error: function(){alert('error')},
          success: function(result){
               $tabs.tabs('load', 0);
          }
        });
    }
}

//删除账号
function del_user(uid){
	if(confirm('<?php echo ((is_array($_tmp='确定删除该账号?')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
')){
		$.ajax({
	      type: "POST",
	      url: "admin.php?ctrl=user&act=submit&type=delete_user",
	      data: "uid="+uid,
	      timeout: 20000,
	      error: function(){alert('error')},
	      success: function(result){
	    	   $tabs.tabs('load', 0); //重新加载列表
	      }
	    });
	}
}

//重置密码
function reset_password(uid){
    if(confirm('<?php echo ((is_array($_tmp='确定重置密码?')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
')){
        $.ajax({
          type: "POST",
          url: "admin.php?ctrl=user&act=submit&type=reset_password",
          data: "uid="+uid,
          timeout: 20000,
          error: function(){alert('error')},
          success: function(result){
        	  $.dialog.alert(result);
          }
        });
    }
}

//清空错误登录次数
function clear_login_err(username){
    if(confirm('<?php echo ((is_array($_tmp='确定清空错误登录次数?')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
')){
        $.ajax({
          type: "POST",
          url: "admin.php?ctrl=user&act=submit&type=clear_login_err",
          data: "username="+username,
          timeout: 20000,
          error: function(){alert('error')},
          success: function(result){
        	  $.dialog.alert(result);
          }
        });
    }
}
</script>